(cl:in-package #:sicl-boot-phase-1)

(defun boot (boot)
  (format *trace-output* "Start phase 1~%")
  (with-accessors ((e0 sicl-boot:e0)
                   (e1 sicl-boot:e1))
      boot
    (change-class e1 'environment)
    (let ((sicl-client:*client* (make-instance 'client)))
      (setf (env:fdefinition sicl-client:*client* e0 'sicl-boot:ast-eval)
            (lambda (client ast)
              (sicl-ast-evaluator:eval-ast client e0 ast)))
      (setf (env:macro-function sicl-client:*client* e0 'in-package)
            (lambda (form environment)
              (declare (ignore environment))
              (setf *package* (find-package (second form)))
              nil))
      (pre-fill-environments e0 e1)
      (fill-environment e0))))
